package com.ymatou.iapi.csim.service;

import com.ymatou.iapi.csim.parameter.SendMessageToCSResp;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.DataUtil;
import com.ymttest.utils.EnvSetup;
/**
*客服主动开启新会话Call
*FreeMaker Template自动生成代码
*/
public class OpenSessionCall extends YmatouBaseCall{
	private static String opurl ="api/cs/OpenSession";
	
	public OpenSessionCall() {
		super(EnvSetup.getSystemUrl("csim_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
    public String getStatus()
    {
    	String data = null;
        try {
            data = getString("Status");

        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }
    
	
    public String getSeesionId()
    {
    	String data = null;
        try {
            data = DataUtil.Json.parseJsonObj(getString("Result")).getString("SessionId");

        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }
    
    
    public String getSuccess()
    {
    	String data = null;
        try {
            data = DataUtil.Json.parseJsonObj(getString("Result")).getString("Success");

        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }
    
    
    public String getErrorMessage()
    {
    	String data = null;
        try {
            data = DataUtil.Json.parseJsonObj(getString("Result")).getString("ErrorMessage");

        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }
}